/*
 *  Copyright (C) 2011 JiangHongTiao <jjurco.sk_gmail.com>
 * 
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 * 
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package sk.lieskove301.jianghongtiao.liaad.prisoner.gene;

import sk.lieskove301.jianghongtiao.math.statistic.distributions.*;

/**
 * Date of create: May 15, 2011
 *
 * @author JiangHongTiao <jjurco.sk_gmail.com>
 * @version 2011.0515
 */
public enum GeneEnum {
    
    Betray(new Betray()),
    Cooperate(new Cooperate()),
    //distributions 
    Beta(new BetaDistribution()),
    Binomial(new BinomialDistribution()),
    ChiSquare(new ChiSquareDistribution()),
    Exponential(new ExponentialDistribution()),
    Gamma(new GammaDistribution()),
    NegativeBinomial(new NegativeBinomialDistribution()),
    Normal( new NormalDistribution()),
    StudentT(new StudentDistribution()),
    Uniform(new UniformDistribution()),
    
    Cauchy(new CauchyDistribution()),
    Geometric(new GeometricDistribution()),
    Laplace(new LaplaceDistribution()),
    Logistic(new LogisticDistribution()),
    PowLaw(new PowLawDistribution()),
    Triangular(new TriangularDistribution()),
    Weibull(new WeibullDistribution())
    
//    BreitWigner(new BreitWignerDistribution()), //cauchy distribution
//    BreitWignerMeanSquare(BreitWignerMeanSquareDistribution()),
//    Empirical(new EmpiricalDistribution()),
//    EmpiricalWalker(new EmpiricalWalkerDistribution()),
//    ExponentialPower(new ExponentialPowerDsitribution()),
//    Fun(new FunDistribution()),
//    Hyperbolic(new HyperbolicDistribution()),
//    HyperGeometric(new HyperGeometricDistribution()),
//    Logarithmic(new LogarithmicDistribution()),
//    Poisson(new PoissonDistribution()),
//    PoissonSlow(new PoissonSlowDistribution()),
//    VonMises(new VonMisesDistribution()),
//    Zeta(new ZetaDistribution()),

//    Burr1(new Burr1Distribution()),
//    Burr2(new Burr2Distribution()),
//    Erlang(new ErlangDistribution()),
//    Lambda(new LambdaDistribution()),
//    ZipfInt(new ZipfIntDistr())
    ;

    private final Distribution distr;

    GeneEnum(Distribution d){
        this.distr = d;

    }

    public static GeneEnum getById(int id){
        return GeneEnum.values()[Math.abs(id) % GeneEnum.values().length];
    }

    public Distribution value() {
        return distr;
    }

    public static GeneEnum fromValue(Distribution d) {
        for (GeneEnum c: GeneEnum.values()) {
            if (c.distr.equals(d)) {
                return c;
            }
        }
        throw new IllegalArgumentException(d.toString());
    }

}
